//
//  LWBtabBarViewController.m
//  QQ界面
//
//  Created by apple on 16/10/22.
//  Copyright © 2016年 LWB. All rights reserved.
//

#import "LWBtabBarViewController.h"
#import "LWBNavgaViewController.h"
#import "PhoneViewController.h"
#import "DynamicViewController.h"
#import "ContactsViewController.h"
#import "MessageViewController.h"

@interface LWBtabBarViewController ()

@end

@implementation LWBtabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpAllControllers];
    // Do any additional setup after loading the view.
}
-(void)setUpAllControllers{
    //消息界面
     MessageViewController *message = [[MessageViewController alloc]init];
    [self setUpChildViewController:message andTitle:@"消息" andTitleColor:[UIColor blueColor]];
    //联系人界面
    ContactsViewController *contact = [[ContactsViewController alloc]init];
    [self setUpChildViewController:contact andTitle:@"联系人" andTitleColor:[UIColor blueColor]];
    //动态界面
    DynamicViewController *dynam = [[DynamicViewController alloc]init];
    [self setUpChildViewController:dynam andTitle:@"动态" andTitleColor:[UIColor blueColor]];
}
-(void)setUpChildViewController:(UIViewController *)vieCont
                       andTitle:(NSString *)title
                  andTitleColor:(UIColor *)titcolor{
    LWBNavgaViewController *messageNav = [[LWBNavgaViewController alloc]initWithRootViewController:vieCont];
    messageNav.title = title;
    [self modifyItemTextColor:titcolor andNavC:messageNav];
    [self addChildViewController:messageNav];

    
}
-(void)modifyItemTextColor:(UIColor *)color
                   andNavC:(LWBNavgaViewController *)nav{
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [dict setObject:color forKey:NSForegroundColorAttributeName];
    [nav.tabBarItem setTitleTextAttributes:dict forState:UIControlStateSelected];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
